package com.jqb.sturts2lab02.action;

import com.jqb.struts2lab02.bean.User;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

/**
 * 模型驱动
 */
public class LoginModelDrivenAction extends ActionSupport implements ModelDriven<User>,Preparable {

	private static final long serialVersionUID = 1L;

	private User user = new User();

	@Override
	public User getModel() {
		System.out.println("getModel() invoked...");
		return user;
	}

	@Override
	public String execute() throws Exception {
		System.out.println("execute() invoked...");
		return SUCCESS;
	}

	@Override
	public void prepare() throws Exception {
		/**这里可以完成Action的初始化工作,此方法会被最先调用*/
		System.out.println("prepare() invoked...");
	}
}
